#ifndef ALARMEVENTDELEGATE_H
#define ALARMEVENTDELEGATE_H

#include <QStyledItemDelegate>
#include <QTimeEdit>
#include <QComboBox>
#include <QCheckBox>
#include <QLineEdit>


class AlarmEventDelegate : public QStyledItemDelegate {
    Q_OBJECT
public:
    explicit AlarmEventDelegate(QObject *parent = nullptr);

    // 创建特定类型的编辑器
    QWidget* createEditor(QWidget *parent,
                         const QStyleOptionViewItem &option,
                         const QModelIndex &index) const override;

    // 设置编辑器数据
    void setEditorData(QWidget *editor,
                      const QModelIndex &index) const override;

    // 保存编辑器数据
    void setModelData(QWidget *editor,
                     QAbstractItemModel *model,
                     const QModelIndex &index) const override;

    // 更新编辑器几何形状
    void updateEditorGeometry(QWidget *editor,
                             const QStyleOptionViewItem &option,
                             const QModelIndex &index) const override;

private:
    // 根据列类型创建不同控件
    QWidget* createTimeEditor(QWidget *parent) const;
    QWidget* createRepeatEditor(QWidget *parent) const;
    QWidget* createStateEditor(QWidget *parent) const;
};

#endif // ALARMEVENTDELEGATE_H
